<template>
  <basic-container>
    <div class="card-border">
      <card-header :header-data="headerData"></card-header>
      <div class="card-body">
        <avue-crud :data="subjectOpinionListData"
                   :option="tableoption"
                   :page="page"
                   :table-loading="tableLoading"
                   @on-load="getResultList"
                   @refresh-change="refreshChange"
                   @search-change="searchChange"
                   class="avuecrud">
          <template slot-scope="scope" slot="menu">
            <div class="menu-title" @click.stop="programItemList(scope.row,scope.index)">
              <i class="iconfont iconview icon-primary"></i>
              <p class="menu-title-text">分解方案详情</p>
            </div>
          </template>
        </avue-crud>
      </div>
    </div>
  </basic-container>
</template>

<script>
  import {getDecomposeDraftList} from "@/api/pim/pim";

  export default {
    name: "assessList",
    created(){
         window.subjectOpinionDeletee = this.subjectOpinionDeletee;
    },
    data(){
      return{
        headerData: {
          title: '实施监测'
        },
        subjectOpinionListData:[],
        page: {
          total: 0, // 总页数
          currentPage: 1, // 当前页数
          pageSize: 10 // 每页显示多少条
        },
        tableLoading:false,
        tableoption: {
          page: true,
          menuWidth: 150,
          addBtn: false,
          editBtn: false,
          addRowBtn: false,
          indexLabel: "序号",
          index: false,
          cellBtn: false,
  indexWidth:70,
          delBtn: false,
          columnBtn: false,
          refreshBtn: false,
          filterBtn: false,
          searchBtn: false,
          keyId: "id",
          column: [
            {
              label: "方案名称",
              width: 260,
              prop: "planningTitle",
              cell: true,
              formatter: function (row, value, label, column) {
                return '<a style="cursor: pointer; " onclick="subjectOpinionDeletee(\'' + row.id + '\',\'' + 1 + '\')">' + value + '责任分解方案' + '</a>';

              }
            },
            {
              label: "方案描述",
              prop: "description",
              cell: true
            },
            {
              label: "状态",
              prop: "state",
              cell: true,
              width: 130,
              dicData:[
                {
                  label:'已编制',
                  value:'0'
                },{
                  label:'征求意见中',
                  value:'1'
                },{
                  label:'已下达',
                  value:'2'
                },
              ]
            },
          ]
        },
      }
    },
    methods: {
      subjectOpinionDeletee(row,watch){
        sessionStorage.setItem('modifyProgram',row)
        let src = '/modifyProgram/detail';
        this.$router.push({
          path: src,
          query:{
            watch:watch
          }
        })
      },
      searchChange() {

      },
      refreshChange() {

      },
      getResultList(page) {
        getDecomposeDraftList(Object.assign({
          current: page.currentPage,
          size: page.pageSize,
          state:'2'
        })).then(response =>{
          this.subjectOpinionListData = response.data.data.records;
        })
      },
      // //配置监测项
      // workingItemList(row){
      //   let src = `/pim/workingItem/index/${row.id}`;
      //   this.$router.push({
      //     path: src,
      //   })
      // },
      //分解方案详情
      programItemList(row){
        let src = `/programItemList/detail/${row.id}`;
        this.$router.push({
          path: src,
        })
      },
    }

  }
</script>

<style scoped>

</style>
